<%include file="header.html"%> <%include file="top.html"%> <%include
file="left.html"%>

<style>
.middle {
	*position: absolute;
	*top: 50%;
}
</style>

<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs"><script
	type="text/javascript">
	try {
		ace.settings.check('breadcrumbs', 'fixed')
	} catch (e) {
	}
</script>

<ul class="breadcrumb">
	<li><i class="icon-home home-icon"></i> <a
		href="index.php">首页</a></li>
</ul>
<!-- .breadcrumb --></div>

<div class="page-content">

<div class="row">
<div class="col-xs-12"><!-- PAGE CONTENT BEGINS -->

<div class="row">
<div class="col-sm-12">
<div class="widget-box">
<div class="widget-header header-color-blue2">cdk使用情况
<h4 class="lighter smaller"></h4>
</div>

<div class="widget-body">
<div class="widget-main padding-8">
<form class="form-horizontal" role="form">

<center>

<div class="form-group"><label
	class="col-sm-6 control-label no-padding-right" for="form-field-1"><strong>cdk使用情况</strong></label>
<span> &nbsp;</span></div>

<table style="width: 80%;" id="sample-table-1"
	class="table table-striped table-bordered table-hover ">
	<thead>
		<tr>
			<th class="col-sm-1">类别</th>
			<th class="col-sm-1">条件</th>
			<th class="col-sm-1">操作</th>

		</tr>
	</thead>

	<tbody>
		<tr>

			<th style="width: 50%;"><label
				class="col-sm-6 control-label no-padding-right" for="form-field-5">CDK</label>
			</th>
			<th class="col-sm-6">
			<div class="col-sm-2"><input type="text" id="selectCdk"
				placeholder="" style="width: 250px;" class="col-xs-1 col-sm-1" /></div>
			</th>
			<th align=center class="col-sm-1">
			<center>
			<button valign="bottom" type="button" onclick="selectCdkInfo();"
				class="btn btn-info btn-success">查询</button>
			</center>
			</th>
		</tr>

	</tbody>
</table>
</center>
</form>
<div class="table-responsive">
<center>

<table style="width: 80%;" id="sample-table-1"
	class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th>cdkey</th>
			<th>游戏</th>
			<th>使用平台</th>
			<th>使用服务器</th>
			<th>玩家id</th>
			<th>玩家名字</th>
			<th>使用时间</th>
			<th>cdkey奖励内容</th>
		</tr>
	</thead>

	<tbody>

		<%if $errorMsg%>
		<tr>
			<td style="color: red" colspan="8">
			<center><%$errorMsg%></center>
			</td>
		</tr>
		<%elseif $game%>
		<tr>
			<td><%$cdk%></td>
			<td><%$game%></td>
			<td><%$platform%></td>
			<td><%$server%></td>
			<td><%$playerid%></td>
			<td><%$playername%></td>
			<td><%$usetime%></td>
			<td><%$reward%></td>
		</tr>
		<%/if%>

	</tbody>

</table>
</center>


<center>
<form class="form-horizontal" role="form">

<div class="form-group"><label
	class="col-sm-6 control-label no-padding-right" for="form-field-2"><strong>cdk类型查询</strong></label>
<span> &nbsp;</span></div>
<table style="width: 80%;" id="sample-table-1"
	class="table table-striped table-bordered table-hover ">
	<thead>
		<tr>
			<th class="col-sm-1">类别</th>
			<th class="col-sm-1">条件</th>
			<th class="col-sm-1">操作</th>
		</tr>
	</thead>

	<tbody>
		<tr>
			<td style="width: 50%;"><label
				class="col-sm-6 control-label no-padding-right" for="form-field-5">游
			戏</label></td>
			<td>
			<div class="col-sm-3"><select id="selectGame">
				<option value="">游 戏</option>
				<%if $selectGames%> <%foreach from = $selectGames key = key item =
				value%> <%if $nowGame == $value %>
				<option value="<%$value%>" selected><%$value%></option>
				<%else%>
				<option value="<%$value%>"><%$value%></option>
				<%/if%> <%/foreach%> <%/if%>
			</select></div>

			</td>
			<td style="padding-top: 25px;" id="middle" rowspan=2 class="col-sm-1">
			<center>
			<button type="button" onclick="selectCdkType();"
				class="btn btn-info btn-success">查询</button>
			</center>

			</td>



		</tr>
		<tr>
			<th class="col-sm-4"><label
				class="col-sm-6 control-label no-padding-right" for="form-field-5">类
			型</label></th>
			<th class="col-sm-6">
			<div class="col-sm-2"><input type="text" id="cdkType"
				placeholder="" style="width: 250px;" class="col-xs-1 col-sm-1" /></div>
			</th>
		</tr>

	</tbody>

</table>
</form>
</center>



<center>

<table style="width:80%;" id="sample-table-1"
	class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th>游戏</th>
			<th>平台</th>
			<th>cdk类型</th>
			<th>cdk奖励内容</th>
			<th>生成时间</th>
			<th>开始时间</th>
			<th>结束时间</th>
			<th>下载</th>
		</tr>
	</thead>

	<tbody>
		<%if $errorMsg2%>
		<tr>
			<td style="color: red" colspan="9">
			<center><%$errorMsg2%></center>
			</td>
		</tr>
		<%elseif $type == 0 && $game2%>
		<tr>
			<td><%$game2%></td>
			<td><%$platform2%></td>
			<td><%$type2%></td>
			<td><%$reward2%></td>
			<td><%$createtime2%></td>
			<td><%$starttime2%></td>
			<td><%$endtime2%></td>
			<th><a class="red" target="_blank" href="<%$cdkDownloadUrl%><%$game2%>-<%$type2%>.txt">
																<i class="icon-download bigger-130"></i>下载
															</a></th>
		</tr>
		<%elseif $type == 1%>
		<%foreach from=$cdkInfo item=cdkInfo%>
		<tr>
			<td><%$cdkInfo.game%></td>
			<td><%$cdkInfo.platform%></td>
			<td><%$cdkInfo.type%></td>
			<td><%$cdkInfo.reward%></td>
			<td><%$cdkInfo.createtime%></td>
			<td><%$cdkInfo.starttime%></td>
			<td><%$cdkInfo.endtime%></td>
			<th><a class="red" target="_blank" href="<%$cdkDownloadUrl%><%$cdkInfo.game%>-<%$cdkInfo.type%>.txt">
																<i class="icon-download bigger-130"></i>下载
															</a></th>
		</tr>
		<%/foreach%>
		<%/if%>
	</tbody>
</table>
</center>
</div>
<!-- /.table-responsive --></div>
</div>
<!-- /.row --></div>
<!-- /.page-content --></div>
<!-- /.main-content --></div>
</div>
</div>

<!-- /.table-responsive --></div>
</div>
<!-- /.page-content -->
</div>
<!-- /.main-content -->
<script type="text/javascript">
	jQuery(function($) {
		$('.date-picker').datepicker({
			autoclose : true
		}).next().on(ace.click_event, function() {
			$(this).prev().focus();
		});
		/*
		 var oTable1 = $('#sample-table-1').dataTable({
		 "aoColumns" : [ {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, {
		 "bSortable" : false
		 }, 
		 ]
		 });

		 */
		/* { "bSortable": false }
		 */


	});

	function selectCdkInfo() {
		var cdk = $('#selectCdk').val();

		if (!cdk) {
			alert('请输入查询的cdk！');
		} else {
			url = "index.php?mod=Cdk&do=cdkUse&cdk=" + cdk;
			window.location.href = url;
		}

	}

	// 查询cdk类型
	function selectCdkType() {
		var game = $('#selectGame').val();
		var cdkType = $('#cdkType').val();
		if (!game) {
			alert('请选择游戏!');
		} else {
			url = "index.php?mod=Cdk&do=selectCdkType&game=" + game
					+ "&cdkType=" + cdkType;
			window.location.href = url;
		}
	}

	/*	
	 window.onload = function(){
	 var select = document.getElementById('selectGame');
	 select.onchange = function(){
	 // 更改值后执行的代码
	 var gameName = jQuery("#selectGame  option:selected").text();
	 var _tagNum = 1;
	 $.ajax({
	 type: "POST",
	 url: "index.php?mod=Game&do=getPlatformByGame&game=" + gameName,
	 data: "",
	 dataType: 'html',
	 success: function(data) {					
	 var dataObj = eval("(" + data + ")");//转换为json对象
	
	 if(dataObj == null) {
	 $("#platform").empty();
	 $("#platform").append('<option value="" id="selectPlatform">平    台</option>');
	 $("#channel").empty();
	 $("#channel").append('<option value="" id="selectChannel">渠    道</option>');
	 }
	
	 var platform = dataObj.platform;
	 $("#platform").empty();
	 $("#platform").append('<option value="" id="selectPlatform">平    台</option>');
	 for(var i=0;i<platform.length;i++){
	 $("#platform").append("<option value='"+platform[i]+"' >"+platform[i]+"</option>"+"<br/>");
	 }
	
	 var channel = dataObj.channel;
	 $("#channel").empty();
	 $("#channel").append('<option value="" id="selectChannel">渠    道</option>');
	 for(var i=0;i<channel.length;i++){
	 $("#channel").append("<option value='"+channel[i]+"' >"+channel[i]+"</option>"+"<br/>");
	 }
	 }
	 });
	 }
	
	 } 
	 */
</script>
<%include file="footer.html"%>

